<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
          "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>QUnit for KJUR.crypto.MessageDigest</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="qunit.js"></script>
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen" />

<script src="../jsrsasign-all-min.js"></script>
<script src="../src/crypto-1.1.js"></script>
<script src="../ext/rsa.js"></script>
<script src="../ext/rsa2.js"></script>

<script type="text/javascript">
$(document).ready(function(){

test("KJUR.crypto.MessageDigest.getCanonicalAlgName", function() {
  var MD = KJUR.crypto.MessageDigest;
  equal(MD.getCanonicalAlgName("sha1"), "sha1", "sha1 > sha1");
  equal(MD.getCanonicalAlgName("SHA1"), "sha1", "SHA1 > sha1");
  equal(MD.getCanonicalAlgName("SHA-1"), "sha1", "SHA-1 > sha1");
  equal(MD.getCanonicalAlgName("SHA-256"), "sha256", "SHA-256 > sha256");
});

test("KJUR.crypto.MessageDigest.HASHLENGTH", function() {
  var MD = KJUR.crypto.MessageDigest;
  equal(MD.HASHLENGTH["md5"], 16, "md5 > 16");
  equal(MD.HASHLENGTH["sha1"], 20, "sha1 > 20");
  equal(MD.HASHLENGTH["sha256"], 32, "sha256 > 32");
  equal(MD.HASHLENGTH["sha512"], 64, "sha512 > 64");
  equal(MD.HASHLENGTH["ripemd160"], 20, "ripemd160 > 20");
});

test("KJUR.crypto.MessageDigest.getHashLength", function() {
  var MD = KJUR.crypto.MessageDigest;
  equal(MD.getHashLength("sha1"), 20, "sha1 > 20");
  equal(MD.getHashLength("SHA1"), 20, "SHA1 > 20");
  equal(MD.getHashLength("SHA-1"), 20, "SHA-1 > 20");
  equal(MD.getHashLength("SHA-256"), 32, "SHA-256 > 32");
});

test("KJUR.crypto.MessageDigest.digest sha1", function() {
  var md = new KJUR.crypto.MessageDigest({alg: "sha1"});
  md.updateString("aaa");
  equal(md.digest(), "7e240de74fb1ed08fa08d38063f6a6a91462a815", "sha1(aaa) = 7e24...");
});

});
</script>
  
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture">test markup</div>
QUnit for 
<a href="index.html">INDEX</a> | 
</body>
<center><p>&copy; 2016 Kenji Urushima</p></center>
</html>


